function getUrl(){
    var url = window.location.href;
    var path = window.location.pathname;
    var search = window.location.search;
    url = url.replace(path,"/");
    url = url.replace(search,"")
    return url;
}

$("#adminLogin").click(function () {
    
    const url = getUrl();

    const map ={
        "adminId":$("#adminId").val(),
        "adminPassword":$("#adminPassword").val()
    }

    console.log(map);


    $.ajax({
        url:url+"adminLogin",
        data:JSON.stringify(map),
        type: "post",
        contentType: "application/json; charset=utf-8",
        success: function(data) {
            if(data=="unLogin"){
                location.href="login.html";
            }else{
                location.href="admin/listInfo.html";
            }
        },
        error:function(data){
            console.log("----------");
            console.log(data);
        }
    })

})

$("#studentLogin").click(function () {
    
    const url = getUrl();

    const map ={
        "studentId":$("#studentId").val(),
        "studentPassword":$("#studentPassword").val()
    }

    console.log(map);


    $.ajax({
        url:url+"studentLogin",
        data:JSON.stringify(map),
        type: "post",
        contentType: "application/json; charset=utf-8",
        success: function(data) {
            if(data=="unLogin"){
                location.href="login.html";
            }else{
                location.href="student/studentInfo.html";
            }
        },
        error:function(data){
            console.log("----------");
            console.log(data);
        }
    })

})